// 引入集合模型
const { tenantsModel } = require('./models/tenantsModel');

// 增加租客信息
module.exports.tenantsName = async function (item) {
    const result = await tenantsModel.create(item);
    return result;
}


// 获取租客信息
module.exports.getTenantsData = async function ({pagesize,currentpage}) {
    console.log({pagesize,currentpage});
    const result = await tenantsModel.find().limit(pagesize-0).skip((currentpage-1)*pagesize);
    const total = await tenantsModel.countDocuments()
    console.log(result);
    return {result,total};
}

//审核身份证
module.exports.checkTenants= async function({_id,state}){
    const result = await tenantsModel.updateOne({_id},{state})
    console.log(result);
    return result
}